package cn.itcast.dao;

import cn.itcast.domain.Courier;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface CourierDao extends JpaRepository<Courier,Integer> ,JpaSpecificationExecutor<Courier>{
    // 根据ID更改删除的标志位作废
    @Modifying
    @Transactional
    @Query("update Courier set deltag = '1' where id = ?1")
    void updateDelTagById(int id);

    // 根据ID更改删除的标志位 还原
    @Modifying
    @Transactional
    @Query("update Courier set deltag = null where id = ?1")
    void updateById(int id);

}
